package com.bjpowernode.money.mapper;

import com.bjpowernode.money.model.FinanceAccount;
import org.apache.ibatis.annotations.Param;

public interface FinanceAccountMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(FinanceAccount record);

    int insertSelective(FinanceAccount record);

    FinanceAccount selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(FinanceAccount record);

    int updateByPrimaryKey(FinanceAccount record);

    FinanceAccount selectFinanceByUserId(Integer userId);

    // 投资：减钱
    int updateAvailableMoneyForInvest(@Param("userId") Integer userId, @Param("bidMoney") Double bidMoney);

    // 收益：多条加钱
    int updateAvailableMoneyForIncome(@Param("uid") Integer uid, @Param("incomeMoney") Double incomeMoney);

    // 充值：加钱
    int updateAvailableMoneyForRecharge(@Param("userId") Integer userId, @Param("rechargeMoney") double rechargeMoney, @Param("version") int version);

    // 追加乐观锁version
    int selectVersionByUid(Integer userId);
}